<?php

if (!defined('BASEPATH'))
    exit('No direct script access allowed');

class kemiskinan extends CI_Controller {

    public function __construct() {
        parent::__construct();
        $this->load->library('session');
        $this->load->helper('url');
        $this->load->library('form_validation');
        $this->load->library("pagination");
        $this->load->model('desa_model');
        $this->load->model('penduduk_model');
    }

    function aksara() {
        $this->load->view('theme/header');
        $this->load->view('theme/sidebar_miskin');
        $this->load->view('kemiskinan/v', array('list_kecamatan' => $this->penduduk_model->get_list_kecamatan()));
        $this->load->view('theme/footer');
        $this->load->view('js/js_miskin', array('chart' => 'kemiskinan/chart_aksara'));
    }

    function cara_dapat_minum() {
        $this->load->view('theme/header');
        $this->load->view('theme/sidebar_miskin2');
        $this->load->view('kemiskinan/v', array('list_kecamatan' => $this->penduduk_model->get_list_kecamatan()));
        $this->load->view('theme/footer');
        $this->load->view('js/js_miskin', array('chart' => 'kemiskinan/chart_cara_dapat_minum'));
    }

    public function index() {
        $this->load->view('theme/header');
        $this->load->view('theme/sidebar_miskin');
        $list_kecamatan = $this->penduduk_model->get_list_kecamatan();
        $this->load->view('kemiskinan/v_jumlah', array('list_kecamatan' => $list_kecamatan));
        $this->load->view('theme/footer');
        $this->load->view('js/js_pekerjaan', array('controller' => 'kemiskinan', 'fungsix' => 'chart'));
    }

    function energi_memasak() {
        $this->load->view('theme/header');
        $this->load->view('theme/sidebar_miskin2');
        $this->load->view('kemiskinan/v', array('list_kecamatan' => $this->penduduk_model->get_list_kecamatan()));
        $this->load->view('theme/footer');
        $this->load->view('js/js_miskin', array('chart' => 'kemiskinan/chart_energi_memasak'));
    }

    function jenis_atap() {
        $this->load->view('theme/header');
        $this->load->view('theme/sidebar_miskin2');
        $this->load->view('kemiskinan/v', array('list_kecamatan' => $this->penduduk_model->get_list_kecamatan()));
        $this->load->view('theme/footer');
        $this->load->view('js/js_miskin', array('chart' => 'kemiskinan/chart_jenis_atap'));
    }

    function jenis_dinding() {
        $this->load->view('theme/header');
        $this->load->view('theme/sidebar_miskin2');
        $this->load->view('kemiskinan/v', array('list_kecamatan' => $this->penduduk_model->get_list_kecamatan()));
        $this->load->view('theme/footer');
        $this->load->view('js/js_miskin', array('chart' => 'kemiskinan/chart_jenis_dinding'));
    }

    function jenis_lantai() {
        $this->load->view('theme/header');
        $this->load->view('theme/sidebar_miskin2');
        $this->load->view('kemiskinan/v', array('list_kecamatan' => $this->penduduk_model->get_list_kecamatan()));
        $this->load->view('theme/footer');
        $this->load->view('js/js_miskin', array('chart' => 'kemiskinan/chart_jenis_lantai'));
    }

    function kepemilikan_kartu_id() {
        $this->load->view('theme/header');
        $this->load->view('theme/sidebar_miskin');
        $this->load->view('kemiskinan/v', array('list_kecamatan' => $this->penduduk_model->get_list_kecamatan()));
        $this->load->view('theme/footer');
        $this->load->view('js/js_miskin', array('chart' => 'kemiskinan/chart_kepemilikan_kartu_id'));
    }

    function luas_tanah() {
        $this->load->view('theme/header');
        $this->load->view('theme/sidebar_miskin2');
        $this->load->view('kemiskinan/v', array('list_kecamatan' => $this->penduduk_model->get_list_kecamatan()));
        $this->load->view('theme/footer');
        $this->load->view('js/js_miskin', array('chart' => 'kemiskinan/chart_luas_tanah'));
    }

    function merokok() {
        $this->load->view('theme/header');
        $this->load->view('theme/sidebar_miskin2');
        $this->load->view('kemiskinan/v', array('list_kecamatan' => $this->penduduk_model->get_list_kecamatan()));
        $this->load->view('theme/footer');
        $this->load->view('js/js_miskin', array('chart' => 'kemiskinan/chart_merokok'));
    }

    function chart_merokok() {
        $this->load->model('kemiskinan_model');
        $id_kec = $this->input->post('id_kecamatan');
        $id_kel = $this->input->post('id_kelurahan');
        $query = $this->kemiskinan_model->getChartMerokok($id_kec, $id_kel);
        $subtitle = array("BANYUWANGI");
        $kec = $this->penduduk_model->get_kec_nama($id_kec);
        if (strlen($kec) > 0) {
            $subtitle[] = $kec;
            $kel = $this->penduduk_model->get_kel_nama($id_kec, $id_kel);
            if (strlen($kel)) {
                $subtitle[] = $kel;
            }
        }
        $this->load->view('chart/pie', array(
            'data' => $query,
            'judul' => 'Jumlah KK Miskin berdasarkan Merokok',
            'subtitle' => $subtitle,
            'kolom' => 'Merokok',
            'id_kecamatan' => $id_kec,
            'controller' => 'kemiskinan/lihat_merokok'
                )
        );
    }

    function partisipasi_sekolah() {
        $this->load->view('theme/header');
        $this->load->view('theme/sidebar_miskin');
        $this->load->view('kemiskinan/v', array('list_kecamatan' => $this->penduduk_model->get_list_kecamatan()));
        $this->load->view('theme/footer');
        $this->load->view('js/js_pekerjaan', array('chart' => 'kemiskinan/chart_partisipasi_sekolah'));
    }

    public function pekerjaan() {
        $this->load->view('theme/header');
        $this->load->view('theme/sidebar_miskin');
        $this->load->view('kemiskinan/v_pekerjaan');
        $this->load->view('theme/footer');
    }

    public function pendidikan() {
        $this->load->view('theme/header');
        $this->load->view('theme/sidebar_miskin');
        $this->load->view('kemiskinan/v_pendidikan');
        $this->load->view('theme/footer');
    }

    function penyakit_kronis() {
        $this->load->view('theme/header');
        $this->load->view('theme/sidebar_miskin');
        $this->load->view('kemiskinan/v', array('list_kecamatan' => $this->penduduk_model->get_list_kecamatan()));
        $this->load->view('theme/footer');
        $this->load->view('js/js_miskin', array('chart' => 'kemiskinan/chart_penyakit_kronis'));
    }

    function req_kelurahan() {
        $this->load->model('kemiskinan_model');
        $id_kec = $this->input->post('id_kecamatan');
        $list_kelurahan = $this->kemiskinan_model->get_list_kelurahan($id_kec);
        echo '<option value="0">Semua Kelurahan</option>';
        foreach ($list_kelurahan as $kel) {
            echo '<option value="' . $kel->id_kelurahan . '">' . $kel->nama_kelurahan . '</option>';
        }
    }

    function status_cacat() {
        $this->load->view('theme/header');
        $this->load->view('theme/sidebar_miskin');
        $this->load->view('kemiskinan/v', array('list_kecamatan' => $this->penduduk_model->get_list_kecamatan()));
        $this->load->view('theme/footer');
        $this->load->view('js/js_miskin', array('chart' => 'kemiskinan/chart_status_cacat'));
    }

    function status_dalam_keluarga() {
        $this->load->view('theme/header');
        $this->load->view('theme/sidebar_miskin');
        $this->load->view('kemiskinan/v', array(
            'list_kecamatan' => $this->penduduk_model->get_list_kecamatan(),
            'show_kelurahan' => false
                )
        );
        $this->load->view('theme/footer');
        $this->load->view('js/js_miskin', array('chart' => 'kemiskinan/chart_status_dalam_keluarga'));
    }

    public function status_kawin() {
        $this->load->view('theme/header');
        $this->load->view('theme/sidebar_miskin');
        $this->load->view('kemiskinan/v_status');
        $this->load->view('theme/footer');
    }

    function sumber_minum() {
        $this->load->view('theme/header');
        $this->load->view('theme/sidebar_miskin2');
        $this->load->view('kemiskinan/v', array('list_kecamatan' => $this->penduduk_model->get_list_kecamatan()));
        $this->load->view('theme/footer');
        $this->load->view('js/js_miskin', array('chart' => 'kemiskinan/chart_sumber_minum'));
    }

    function sumber_penerangan() {
        $this->load->view('theme/header');
        $this->load->view('theme/sidebar_miskin2');
        $this->load->view('kemiskinan/v', array('list_kecamatan' => $this->penduduk_model->get_list_kecamatan()));
        $this->load->view('theme/footer');
        $this->load->view('js/js_miskin', array('chart' => 'kemiskinan/chart_sumber_penerangan'));
    }

    function tempat_tinggal() {
        $this->load->view('theme/header');
        $this->load->view('theme/sidebar_miskin2');
        $this->load->view('kemiskinan/v', array('list_kecamatan' => $this->penduduk_model->get_list_kecamatan()));
        $this->load->view('theme/footer');
        $this->load->view('js/js_miskin', array('chart' => 'kemiskinan/chart_tempat_tinggal'));
    }

    public function usia() {
        $this->load->view('theme/header');
        $this->load->view('theme/sidebar_miskin');
        $list_kecamatan = $this->penduduk_model->get_list_kecamatan();
        $this->load->view('kemiskinan/v_usia', array('list_kecamatan' => $list_kecamatan));
        $this->load->view('theme/footer');
        $this->load->view('js/js_pekerjaan', array('controller' => 'kemiskinan', 'fungsix' => 'chart_usia'));
    }

    function chart_penyakit_kronis() {
        $this->load->model('kemiskinan_model');
        $id_kec = $this->input->post('id_kecamatan');
        $id_kel = $this->input->post('id_kelurahan');
        $query = $this->kemiskinan_model->getChartPenyakitKronis($id_kec, $id_kel);
        $subtitle = array("BANYUWANGI");
        $kec = $this->penduduk_model->get_kec_nama($id_kec);
        if (strlen($kec) > 0) {
            $subtitle[] = $kec;
            $kel = $this->penduduk_model->get_kel_nama($id_kec, $id_kel);
            if (strlen($kel)) {
                $subtitle[] = $kel;
            }
        }
        $this->load->view('chart/pie', array(
            'data' => $query,
            'judul' => 'Jumlah Penduduk Miskin berdasarkan Penyakit Kronis',
            'subtitle' => $subtitle,
            'kolom' => 'Penyakit Kronis',
            'id_kecamatan' => $id_kec,
            'controller' => 'kemiskinan/lihat_penyakit_kronis'
                )
        );
    }

    function chart_partisipasi_sekolah() {
        $this->load->model('kemiskinan_model');
        $id_kec = $this->input->post('id_kecamatan');
        $id_kel = $this->input->post('id_kelurahan');
        $query = $this->kemiskinan_model->getChartPartisipasiSekolah($id_kec, $id_kel);
        $subtitle = array("BANYUWANGI");
        $kec = $this->penduduk_model->get_kec_nama($id_kec);
        if (strlen($kec) > 0) {
            $subtitle[] = $kec;
            $kel = $this->penduduk_model->get_kel_nama($id_kec, $id_kel);
            if (strlen($kel)) {
                $subtitle[] = $kel;
            }
        }
        $this->load->view('chart/pie', array(
            'data' => $query,
            'judul' => 'Jumlah Penduduk Miskin berdasarkan Partisipasi Sekolah',
            'subtitle' => $subtitle,
            'kolom' => 'Partisipasi Sekolah',
            'controller' => 'kemiskinan/lihat_partisipasi_sekolah',
            'id_kecamatan' => $id_kec
                )
        );
    }

    function chart_jenis_atap() {
        $this->load->model('kemiskinan_model');
        $id_kec = $this->input->post('id_kecamatan');
        $id_kel = $this->input->post('id_kelurahan');
        $query = $this->kemiskinan_model->getChartJenisAtap($id_kec, $id_kel);
        $subtitle = array("BANYUWANGI");
        $kec = $this->penduduk_model->get_kec_nama($id_kec);
        if (strlen($kec) > 0) {
            $subtitle[] = $kec;
            $kel = $this->penduduk_model->get_kel_nama($id_kec, $id_kel);
            if (strlen($kel)) {
                $subtitle[] = $kel;
            }
        }
        $this->load->view('chart/pie', array(
            'data' => $query,
            'judul' => 'Jumlah KK Miskin berdasarkan Jenis Atap',
            'subtitle' => $subtitle,
            'kolom' => 'Jenis Atap',
            'id_kecamatan' => $id_kec,
            'controller' => 'kemiskinan/lihat_jenis_atap'
                )
        );
    }

    function chart_jenis_dinding() {
        $this->load->model('kemiskinan_model');
        $id_kec = $this->input->post('id_kecamatan');
        $id_kel = $this->input->post('id_kelurahan');
        $query = $this->kemiskinan_model->getChartJenisDinding($id_kec, $id_kel);
        $subtitle = array("BANYUWANGI");
        $kec = $this->penduduk_model->get_kec_nama($id_kec);
        if (strlen($kec) > 0) {
            $subtitle[] = $kec;
            $kel = $this->penduduk_model->get_kel_nama($id_kec, $id_kel);
            if (strlen($kel)) {
                $subtitle[] = $kel;
            }
        }
        $this->load->view('chart/pie', array(
            'data' => $query,
            'judul' => 'Jumlah KK Miskin berdasarkan Jenis Dinding',
            'subtitle' => $subtitle,
            'kolom' => 'Jenis Dinding',
            'id_kecamatan' => $id_kec,
            'controller' => 'kemiskinan/lihat_jenis_dinding'
                )
        );
    }

    function chart_jenis_lantai() {
        $this->load->model('kemiskinan_model');
        $id_kec = $this->input->post('id_kecamatan');
        $id_kel = $this->input->post('id_kelurahan');
        $query = $this->kemiskinan_model->getChartJenisLantai($id_kec, $id_kel);
        $subtitle = array("BANYUWANGI");
        $kec = $this->penduduk_model->get_kec_nama($id_kec);
        if (strlen($kec) > 0) {
            $subtitle[] = $kec;
            $kel = $this->penduduk_model->get_kel_nama($id_kec, $id_kel);
            if (strlen($kel)) {
                $subtitle[] = $kel;
            }
        }
        $this->load->view('chart/pie', array(
            'data' => $query,
            'judul' => 'Jumlah KK Miskin berdasarkan Jenis Lantai',
            'subtitle' => $subtitle,
            'kolom' => 'Jenis Lantai',
            'controller' => 'kemiskinan/lihat_jenis_lantai',
            'id_kecamatan' => $id_kec
                )
        );
    }

    function chart_kepemilikan_kartu_id() {
        $this->load->model('kemiskinan_model');
        $id_kec = $this->input->post('id_kecamatan');
        $id_kel = $this->input->post('id_kelurahan');
        $query = $this->kemiskinan_model->getChartKepemilikanKartuId($id_kec, $id_kel);
        $subtitle = array("BANYUWANGI");
        $kec = $this->penduduk_model->get_kec_nama($id_kec);
        if (strlen($kec) > 0) {
            $subtitle[] = $kec;
            $kel = $this->penduduk_model->get_kel_nama($id_kec, $id_kel);
            if (strlen($kel)) {
                $subtitle[] = $kel;
            }
        }
        $this->load->view('chart/pie', array(
            'data' => $query,
            'judul' => 'Jumlah Penduduk Miskin berdasarkan Kepemilikan Kartu Identitas',
            'subtitle' => $subtitle,
            'kolom' => 'Kepemilikan Kartu Identitas',
            'controller' => 'kemiskinan/lihat_kepemilikan_kartu_id',
            'id_kecamatan' => $id_kec
                )
        );
    }

    function chart_luas_tanah() {
        $this->load->model('kemiskinan_model');
        $id_kec = $this->input->post('id_kecamatan');
        $id_kel = $this->input->post('id_kelurahan');
        $query = $this->kemiskinan_model->getChartLuasTanah($id_kec, $id_kel);
        $subtitle = array("BANYUWANGI");
        $kec = $this->penduduk_model->get_kec_nama($id_kec);
        if (strlen($kec) > 0) {
            $subtitle[] = $kec;
            $kel = $this->penduduk_model->get_kel_nama($id_kec, $id_kel);
            if (strlen($kel)) {
                $subtitle[] = $kel;
            }
        }
        $this->load->view('chart/pie_tanah', array(
            'data' => $query,
            'judul' => 'Jumlah KK Miskin berdasarkan Luas Tanah',
            'subtitle' => $subtitle,
            'kolom' => 'Luas Tanah',
            'id_kecamatan' => $id_kec,
            'controller' => 'kemiskinan/lihat_luas_tanah'
                )
        );
    }

    function chart_aksara() {
        $this->load->model('kemiskinan_model');
        $id_kec = $this->input->post('id_kecamatan');
        $id_kel = $this->input->post('id_kelurahan');
        $query = $this->kemiskinan_model->getChartStatusKeaksaraan($id_kec, $id_kel);
        $subtitle = array("BANYUWANGI");
        $kec = $this->penduduk_model->get_kec_nama($id_kec);
        if (strlen($kec) > 0) {
            $subtitle[] = $kec;
            $kel = $this->penduduk_model->get_kel_nama($id_kec, $id_kel);
            if (strlen($kel)) {
                $subtitle[] = $kel;
            }
        }
        $this->load->view('chart/pie', array(
            'data' => $query,
            'judul' => 'Jumlah Penduduk Miskin berdasarkan Status Keaksaraan',
            'subtitle' => $subtitle,
            'kolom' => 'Status Keaksaraan',
            'controller' => 'kemiskinan/lihat_aksara',
            'id_kecamatan' => $id_kec
                )
        );
    }

    function chart_cara_dapat_minum() {
        $this->load->model('kemiskinan_model');
        $id_kec = $this->input->post('id_kecamatan');
        $id_kel = $this->input->post('id_kelurahan');
        $query = $this->kemiskinan_model->getChartCaraDapatMinum($id_kec, $id_kel);
        $subtitle = array("BANYUWANGI");
        $kec = $this->penduduk_model->get_kec_nama($id_kec);
        if (strlen($kec) > 0) {
            $subtitle[] = $kec;
            $kel = $this->penduduk_model->get_kel_nama($id_kec, $id_kel);
            if (strlen($kel)) {
                $subtitle[] = $kel;
            }
        }
        $this->load->view('chart/pie', array(
            'data' => $query,
            'judul' => 'Jumlah KK Miskin berdasarkan Cara Mendapatkan Air Minum',
            'subtitle' => $subtitle,
            'kolom' => 'Cara Mendapatkan Air Minum',
            'id_kecamatan' => $id_kec,
            'controller' => 'kemiskinan/lihat_cara_dapat_minum'
                )
        );
    }

    function chart_energi_memasak() {
        $this->load->model('kemiskinan_model');
        $id_kec = $this->input->post('id_kecamatan');
        $id_kel = $this->input->post('id_kelurahan');
        $query = $this->kemiskinan_model->getChartEnergiMasak($id_kec, $id_kel);
        $subtitle = array("BANYUWANGI");
        $kec = $this->penduduk_model->get_kec_nama($id_kec);
        if (strlen($kec) > 0) {
            $subtitle[] = $kec;
            $kel = $this->penduduk_model->get_kel_nama($id_kec, $id_kel);
            if (strlen($kel)) {
                $subtitle[] = $kel;
            }
        }
        $this->load->view('chart/pie', array(
            'data' => $query,
            'judul' => 'Jumlah KK Miskin berdasarkan Cara Bahan Bakar untuk Memasak',
            'subtitle' => $subtitle,
            'kolom' => 'Bahan Bakar',
            'id_kecamatan' => $id_kec,
            'controller' => 'kemiskinan/lihat_energi_memasak'
                )
        );
    }

    function fasilitas_bab() {
        $this->load->view('theme/header');
        $this->load->view('theme/sidebar_miskin2');
        $this->load->view('kemiskinan/v', array('list_kecamatan' => $this->penduduk_model->get_list_kecamatan()));
        $this->load->view('theme/footer');
        $this->load->view('js/js_miskin', array('chart' => 'kemiskinan/chart_fasilitas_bab'));
    }

    function pembuangan_bab() {
        $this->load->view('theme/header');
        $this->load->view('theme/sidebar_miskin2');
        $this->load->view('kemiskinan/v', array('list_kecamatan' => $this->penduduk_model->get_list_kecamatan()));
        $this->load->view('theme/footer');
        $this->load->view('js/js_miskin', array('chart' => 'kemiskinan/chart_pembuangan_bab'));
    }

    function chart_pembuangan_bab() {
        $this->load->model('kemiskinan_model');
        $id_kec = $this->input->post('id_kecamatan');
        $id_kel = $this->input->post('id_kelurahan');
        $query = $this->kemiskinan_model->getChartPembuanganBAB($id_kec, $id_kel);
        $subtitle = array("BANYUWANGI");
        $kec = $this->penduduk_model->get_kec_nama($id_kec);
        if (strlen($kec) > 0) {
            $subtitle[] = $kec;
            $kel = $this->penduduk_model->get_kel_nama($id_kec, $id_kel);
            if (strlen($kel)) {
                $subtitle[] = $kel;
            }
        }
        $this->load->view('chart/pie', array(
            'data' => $query,
            'judul' => 'Jumlah KK Miskin berdasarkan Tempat Pembuangan Tinja',
            'subtitle' => $subtitle,
            'kolom' => 'Nama Lokasi',
            'id_kecamatan' => $id_kec,
            'controller' => 'kemiskinan/lihat_pembuangan_bab'
                )
        );
    }

    function chart_fasilitas_bab() {
        $this->load->model('kemiskinan_model');
        $id_kec = $this->input->post('id_kecamatan');
        $id_kel = $this->input->post('id_kelurahan');
        $query = $this->kemiskinan_model->getChartFasilitasBAB($id_kec, $id_kel);
        $subtitle = array("BANYUWANGI");
        $kec = $this->penduduk_model->get_kec_nama($id_kec);
        if (strlen($kec) > 0) {
            $subtitle[] = $kec;
            $kel = $this->penduduk_model->get_kel_nama($id_kec, $id_kel);
            if (strlen($kel)) {
                $subtitle[] = $kel;
            }
        }
        $this->load->view('chart/pie', array(
            'data' => $query,
            'judul' => 'Jumlah KK Miskin berdasarkan Fasilitas BAB',
            'subtitle' => $subtitle,
            'kolom' => 'Fasilitas BAB',
            'id_kecamatan' => $id_kec,
            'controller' => 'kemiskinan/lihat_fasilitas_bab'
                )
        );
    }

    function chart_status_cacat() {
        $this->load->model('kemiskinan_model');
        $id_kec = $this->input->post('id_kecamatan');
        $id_kel = $this->input->post('id_kelurahan');
        $query = $this->kemiskinan_model->getChartStatusCacat($id_kec, $id_kel);
        $subtitle = array("BANYUWANGI");
        $kec = $this->penduduk_model->get_kec_nama($id_kec);
        if (strlen($kec) > 0) {
            $subtitle[] = $kec;
            $kel = $this->penduduk_model->get_kel_nama($id_kec, $id_kel);
            if (strlen($kel)) {
                $subtitle[] = $kel;
            }
        }
        $this->load->view('chart/pie', array(
            'data' => $query,
            'judul' => 'Jumlah Penduduk Miskin berdasarkan Status Cacat',
            'subtitle' => $subtitle,
            'kolom' => 'Status Cacat',
            'controller' => 'kemiskinan/lihat_status_cacat',
            'id_kecamatan' => $id_kec
                )
        );
    }

    function chart_status_dalam_keluarga() {
        $this->load->model('kemiskinan_model');
        $id_kec = $this->input->post('id_kecamatan');
        $id_kel = $this->input->post('id_kelurahan');
        $query = $this->kemiskinan_model->getChartStatusDalamKeluarga($id_kec, $id_kel);
        $subtitle = array("BANYUWANGI");
        $kec = $this->penduduk_model->get_kec_nama($id_kec);
        if (strlen($kec) > 0) {
            $subtitle[] = $kec;
            $kel = $this->penduduk_model->get_kel_nama($id_kec, $id_kel);
            if (strlen($kel)) {
                $subtitle[] = $kel;
            }
        }
        $this->load->view('chart/pie', array(
            'data' => $query,
            'judul' => 'Jumlah Penduduk Miskin berdasarkan Status Dalam Keluarga',
            'subtitle' => $subtitle,
            'kolom' => 'Status Dalam Keluarga',
            'id_kecamatan' => $id_kec,
            'controller' => 'kemiskinan/lihat_status_dalam_keluarga'
                )
        );
    }

    public function chart() {
        $id_kec = $this->input->post('id_kecamatan');
        $id_kel = $this->input->post('id_kelurahan');
        $this->load->model('kemiskinan_model');
        $query = $this->kemiskinan_model->getChart($id_kec, $id_kel);
        $subtitle = array("BANYUWANGI");
        $kec = $this->penduduk_model->get_kec_nama($id_kec);
        if (strlen($kec) > 0) {
            $subtitle[] = $kec;
            $kel = $this->penduduk_model->get_kel_nama($id_kec, $id_kel);
            if (strlen($kel)) {
                $subtitle[] = $kel;
            }
        }
        $this->load->view('chart/bar_miskin2', array('data' => $query, 'judul' => 'Jumlah Penduduk Miskin Berdasarkan Wilayah', 'subtitle' => $subtitle));
    }

    public function chart_usia() {
        $id_kec = $this->input->post('id_kecamatan');
        $id_kel = $this->input->post('id_kelurahan');
        $this->load->model('kemiskinan_model');
        $query = $this->kemiskinan_model->getChartUsia($id_kec, $id_kel);
        $subtitle = array("BANYUWANGI");
        $kec = $this->penduduk_model->get_kec_nama($id_kec);
        if (strlen($kec) > 0) {
            $subtitle[] = $kec;
            $kel = $this->penduduk_model->get_kel_nama($id_kec, $id_kel);
            if (strlen($kel)) {
                $subtitle[] = $kel;
            }
        }
        $this->load->view('chart/bar', array('data' => $query, 'judul' => 'Jumlah Penduduk Miskin Berdasarkan Kelompok Usia', 'subtitle' => $subtitle));
    }

    function chart_sumber_minum() {
        $this->load->model('kemiskinan_model');
        $id_kec = $this->input->post('id_kecamatan');
        $id_kel = $this->input->post('id_kelurahan');
        $query = $this->kemiskinan_model->getChartSumberMinum($id_kec, $id_kel);
        $subtitle = array("BANYUWANGI");
        $kec = $this->penduduk_model->get_kec_nama($id_kec);
        if (strlen($kec) > 0) {
            $subtitle[] = $kec;
            $kel = $this->penduduk_model->get_kel_nama($id_kec, $id_kel);
            if (strlen($kel)) {
                $subtitle[] = $kel;
            }
        }
        $this->load->view('chart/pie', array(
            'data' => $query,
            'judul' => 'Jumlah KK Miskin berdasarkan Kepemilikan Sumber Air Minum',
            'subtitle' => $subtitle,
            'kolom' => 'Sumber Air Minum',
            'id_kecamatan' => $id_kec,
            'controller' => 'kemiskinan/lihat_sumber_minum'
                )
        );
    }

    function chart_sumber_penerangan() {
        $this->load->model('kemiskinan_model');
        $id_kec = $this->input->post('id_kecamatan');
        $id_kel = $this->input->post('id_kelurahan');
        $query = $this->kemiskinan_model->getChartSumberPenerangan($id_kec, $id_kel);
        $subtitle = array("BANYUWANGI");
        $kec = $this->penduduk_model->get_kec_nama($id_kec);
        if (strlen($kec) > 0) {
            $subtitle[] = $kec;
            $kel = $this->penduduk_model->get_kel_nama($id_kec, $id_kel);
            if (strlen($kel)) {
                $subtitle[] = $kel;
            }
        }
        $this->load->view('chart/pie', array(
            'data' => $query,
            'judul' => 'Jumlah KK Miskin berdasarkan Kepemilikan Sumber Penerangan',
            'subtitle' => $subtitle,
            'kolom' => 'Sumber Penerangan',
            'id_kecamatan' => $id_kec,
            'controller' => 'kemiskinan/lihat_sumber_penerangan'
                )
        );
    }

    function chart_tempat_tinggal() {
        $this->load->model('kemiskinan_model');
        $id_kec = $this->input->post('id_kecamatan');
        $id_kel = $this->input->post('id_kelurahan');
        $query = $this->kemiskinan_model->getChartKepimilkanTempatTinggal($id_kec, $id_kel);
        $subtitle = array("BANYUWANGI");
        $kec = $this->penduduk_model->get_kec_nama($id_kec);
        if (strlen($kec) > 0) {
            $subtitle[] = $kec;
            $kel = $this->penduduk_model->get_kel_nama($id_kec, $id_kel);
            if (strlen($kel)) {
                $subtitle[] = $kel;
            }
        }
        $this->load->view('chart/pie', array(
            'data' => $query,
            'judul' => 'Jumlah KK Miskin berdasarkan Kepemilikan Tempat Tinggal',
            'subtitle' => $subtitle,
            'kolom' => 'Status Dalam Keluarga',
            'controller' => 'kemiskinan/lihat_tempat_tinggal',
            'id_kecamatan' => $id_kec
                )
        );
    }

    function mobil() {
        $this->load->view('theme/header');
        $this->load->view('theme/sidebar_miskin2');
        $this->load->view('kemiskinan/v', array('list_kecamatan' => $this->penduduk_model->get_list_kecamatan()));
        $this->load->view('theme/footer');
        $this->load->view('js/js_miskin', array('chart' => 'kemiskinan/chart_mobil'));
    }

    function chart_mobil() {
        $this->load->model('kemiskinan_model');
        $id_kec = $this->input->post('id_kecamatan');
        $id_kel = $this->input->post('id_kelurahan');
        $query = $this->kemiskinan_model->getChartMobil($id_kec, $id_kel);
        $subtitle = array("BANYUWANGI");
        $kec = $this->penduduk_model->get_kec_nama($id_kec);
        if (strlen($kec) > 0) {
            $subtitle[] = $kec;
            $kel = $this->penduduk_model->get_kel_nama($id_kec, $id_kel);
            if (strlen($kel)) {
                $subtitle[] = $kel;
            }
        }
        $this->load->view('chart/pie', array(
            'data' => $query,
            'judul' => 'Jumlah KK Miskin berdasarkan Kepemilikan Mobil',
            'subtitle' => $subtitle,
            'kolom' => 'Punya Mobil',
            'id_kecamatan' => $id_kec,
            'controller' => 'kemiskinan/lihat_mobil'
                )
        );
    }

    function kapal_motor() {
        $this->load->view('theme/header');
        $this->load->view('theme/sidebar_miskin2');
        $this->load->view('kemiskinan/v', array('list_kecamatan' => $this->penduduk_model->get_list_kecamatan()));
        $this->load->view('theme/footer');
        $this->load->view('js/js_miskin', array('chart' => 'kemiskinan/chart_kapal_motor'));
    }

    function chart_kapal_motor() {
        $this->load->model('kemiskinan_model');
        $id_kec = $this->input->post('id_kecamatan');
        $id_kel = $this->input->post('id_kelurahan');
        $query = $this->kemiskinan_model->getChartKapalMotor($id_kec, $id_kel);
        $subtitle = array("BANYUWANGI");
        $kec = $this->penduduk_model->get_kec_nama($id_kec);
        if (strlen($kec) > 0) {
            $subtitle[] = $kec;
            $kel = $this->penduduk_model->get_kel_nama($id_kec, $id_kel);
            if (strlen($kel)) {
                $subtitle[] = $kel;
            }
        }
        $this->load->view('chart/pie', array(
            'data' => $query,
            'judul' => 'Jumlah KK Miskin berdasarkan Kepemilikan Kapal Motor',
            'subtitle' => $subtitle,
            'kolom' => 'Punya Kapal Motor',
            'id_kecamatan' => $id_kec,
            'controller' => 'kemiskinan/lihat_kapal_motor'
                )
        );
    }

    function perahu_motor() {
        $this->load->view('theme/header');
        $this->load->view('theme/sidebar_miskin2');
        $this->load->view('kemiskinan/v', array('list_kecamatan' => $this->penduduk_model->get_list_kecamatan()));
        $this->load->view('theme/footer');
        $this->load->view('js/js_miskin', array('chart' => 'kemiskinan/chart_perahu_motor'));
    }

    function chart_perahu_motor() {
        $this->load->model('kemiskinan_model');
        $id_kec = $this->input->post('id_kecamatan');
        $id_kel = $this->input->post('id_kelurahan');
        $query = $this->kemiskinan_model->getChartPerahuMotor($id_kec, $id_kel);
        $subtitle = array("BANYUWANGI");
        $kec = $this->penduduk_model->get_kec_nama($id_kec);
        if (strlen($kec) > 0) {
            $subtitle[] = $kec;
            $kel = $this->penduduk_model->get_kel_nama($id_kec, $id_kel);
            if (strlen($kel)) {
                $subtitle[] = $kel;
            }
        }
        $this->load->view('chart/pie', array(
            'data' => $query,
            'judul' => 'Jumlah KK Miskin berdasarkan Kepemilikan Perahu Motor',
            'subtitle' => $subtitle,
            'kolom' => 'Punya Perahu Motor',
            'id_kecamatan' => $id_kec,
            'controller' => 'kemiskinan/lihat_perahu_motor'
                )
        );
    }

    function sepeda_motor() {
        $this->load->view('theme/header');
        $this->load->view('theme/sidebar_miskin2');
        $this->load->view('kemiskinan/v', array('list_kecamatan' => $this->penduduk_model->get_list_kecamatan()));
        $this->load->view('theme/footer');
        $this->load->view('js/js_miskin', array('chart' => 'kemiskinan/chart_sepeda_motor'));
    }

    function chart_sepeda_motor() {
        $this->load->model('kemiskinan_model');
        $id_kec = $this->input->post('id_kecamatan');
        $id_kel = $this->input->post('id_kelurahan');
        $query = $this->kemiskinan_model->getChartSepedaMotor($id_kec, $id_kel);
        $subtitle = array("BANYUWANGI");
        $kec = $this->penduduk_model->get_kec_nama($id_kec);
        if (strlen($kec) > 0) {
            $subtitle[] = $kec;
            $kel = $this->penduduk_model->get_kel_nama($id_kec, $id_kel);
            if (strlen($kel)) {
                $subtitle[] = $kel;
            }
        }
        $this->load->view('chart/pie', array(
            'data' => $query,
            'judul' => 'Jumlah KK Miskin berdasarkan Kepemilikan Sepeda Motor',
            'subtitle' => $subtitle,
            'kolom' => 'Punya Sepeda Motor',
            'id_kecamatan' => $id_kec,
            'controller' => 'kemiskinan/lihat_sepeda_motor'
                )
        );
    }

    function sepeda() {
        $this->load->view('theme/header');
        $this->load->view('theme/sidebar_miskin2');
        $this->load->view('kemiskinan/v', array('list_kecamatan' => $this->penduduk_model->get_list_kecamatan()));
        $this->load->view('theme/footer');
        $this->load->view('js/js_miskin', array('chart' => 'kemiskinan/chart_sepeda'));
    }

    function chart_sepeda() {
        $this->load->model('kemiskinan_model');
        $id_kec = $this->input->post('id_kecamatan');
        $id_kel = $this->input->post('id_kelurahan');
        $query = $this->kemiskinan_model->getChartSepeda($id_kec, $id_kel);
        $subtitle = array("BANYUWANGI");
        $kec = $this->penduduk_model->get_kec_nama($id_kec);
        if (strlen($kec) > 0) {
            $subtitle[] = $kec;
            $kel = $this->penduduk_model->get_kel_nama($id_kec, $id_kel);
            if (strlen($kel)) {
                $subtitle[] = $kel;
            }
        }
        $this->load->view('chart/pie', array(
            'data' => $query,
            'judul' => 'Jumlah KK Miskin berdasarkan Kepemilikan Sepeda',
            'subtitle' => $subtitle,
            'kolom' => 'Punya Sepeda',
            'id_kecamatan' => $id_kec,
            'controller' => 'kemiskinan/lihat_sepeda'
                )
        );
    }

    function perahu() {
        $this->load->view('theme/header');
        $this->load->view('theme/sidebar_miskin2');
        $this->load->view('kemiskinan/v', array('list_kecamatan' => $this->penduduk_model->get_list_kecamatan()));
        $this->load->view('theme/footer');
        $this->load->view('js/js_miskin', array('chart' => 'kemiskinan/chart_perahu'));
    }

    function chart_perahu() {
        $this->load->model('kemiskinan_model');
        $id_kec = $this->input->post('id_kecamatan');
        $id_kel = $this->input->post('id_kelurahan');
        $query = $this->kemiskinan_model->getChartPerahu($id_kec, $id_kel);
        $subtitle = array("BANYUWANGI");
        $kec = $this->penduduk_model->get_kec_nama($id_kec);
        if (strlen($kec) > 0) {
            $subtitle[] = $kec;
            $kel = $this->penduduk_model->get_kel_nama($id_kec, $id_kel);
            if (strlen($kel)) {
                $subtitle[] = $kel;
            }
        }
        $this->load->view('chart/pie', array(
            'data' => $query,
            'judul' => 'Jumlah KK Miskin berdasarkan Kepemilikan Perahu',
            'subtitle' => $subtitle,
            'kolom' => 'Punya Perahu',
            'id_kecamatan' => $id_kec,
            'controller' => 'kemiskinan/lihat_perahu'
                )
        );
    }

    function kulkas() {
        $this->load->view('theme/header');
        $this->load->view('theme/sidebar_miskin2');
        $this->load->view('kemiskinan/v', array('list_kecamatan' => $this->penduduk_model->get_list_kecamatan()));
        $this->load->view('theme/footer');
        $this->load->view('js/js_miskin', array('chart' => 'kemiskinan/chart_kulkas'));
    }

    function chart_kulkas() {
        $this->load->model('kemiskinan_model');
        $id_kec = $this->input->post('id_kecamatan');
        $id_kel = $this->input->post('id_kelurahan');
        $query = $this->kemiskinan_model->getChartKulkas($id_kec, $id_kel);
        $subtitle = array("BANYUWANGI");
        $kec = $this->penduduk_model->get_kec_nama($id_kec);
        if (strlen($kec) > 0) {
            $subtitle[] = $kec;
            $kel = $this->penduduk_model->get_kel_nama($id_kec, $id_kel);
            if (strlen($kel)) {
                $subtitle[] = $kel;
            }
        }
        $this->load->view('chart/pie', array(
            'data' => $query,
            'judul' => 'Jumlah KK Miskin berdasarkan Kepemilikan Kulkas',
            'subtitle' => $subtitle,
            'kolom' => 'Punya Kulkas',
            'id_kecamatan' => $id_kec,
            'controller' => 'kemiskinan/lihat_kulkas'
                )
        );
    }

    function elpiji() {
        $this->load->view('theme/header');
        $this->load->view('theme/sidebar_miskin2');
        $this->load->view('kemiskinan/v', array('list_kecamatan' => $this->penduduk_model->get_list_kecamatan()));
        $this->load->view('theme/footer');
        $this->load->view('js/js_miskin', array(
            'chart' => 'kemiskinan/chart_elpiji'
                )
        );
    }

    function chart_elpiji() {
        $this->load->model('kemiskinan_model');
        $id_kec = $this->input->post('id_kecamatan');
        $id_kel = $this->input->post('id_kelurahan');
        $query = $this->kemiskinan_model->getChartElpiji($id_kec, $id_kel);
        $subtitle = array("BANYUWANGI");
        $kec = $this->penduduk_model->get_kec_nama($id_kec);
        if (strlen($kec) > 0) {
            $subtitle[] = $kec;
            $kel = $this->penduduk_model->get_kel_nama($id_kec, $id_kel);
            if (strlen($kel)) {
                $subtitle[] = $kel;
            }
        }
        $this->load->view('chart/pie', array(
            'data' => $query,
            'judul' => 'Jumlah KK Miskin berdasarkan Kepemilikan LPG',
            'subtitle' => $subtitle,
            'kolom' => 'Punya LPG',
            'id_kecamatan' => $id_kec,
            'controller' => 'kemiskinan/lihat_elpiji'
                )
        );
    }

    function hape() {
        $this->load->view('theme/header');
        $this->load->view('theme/sidebar_miskin2');
        $this->load->view('kemiskinan/v', array('list_kecamatan' => $this->penduduk_model->get_list_kecamatan()));
        $this->load->view('theme/footer');
        $this->load->view('js/js_miskin', array(
            'chart' => 'kemiskinan/chart_hape'
                )
        );
    }

    function chart_hape() {
        $this->load->model('kemiskinan_model');
        $id_kec = $this->input->post('id_kecamatan');
        $id_kel = $this->input->post('id_kelurahan');
        $query = $this->kemiskinan_model->getChartHape($id_kec, $id_kel);
        $subtitle = array("BANYUWANGI");
        $kec = $this->penduduk_model->get_kec_nama($id_kec);
        if (strlen($kec) > 0) {
            $subtitle[] = $kec;
            $kel = $this->penduduk_model->get_kel_nama($id_kec, $id_kel);
            if (strlen($kel)) {
                $subtitle[] = $kel;
            }
        }
        $this->load->view('chart/pie', array(
            'data' => $query,
            'judul' => 'Jumlah KK Miskin berdasarkan Kepemilikan HandPhone',
            'subtitle' => $subtitle,
            'kolom' => 'Punya HandPhone',
            'id_kecamatan' => $id_kec,
            'controller' => 'kemiskinan/lihat_hape'
                )
        );
    }

    function pkh() {
        $this->load->view('theme/header');
        $this->load->view('theme/sidebar_miskin2');
        $this->load->view('kemiskinan/v', array('list_kecamatan' => $this->penduduk_model->get_list_kecamatan()));
        $this->load->view('theme/footer');
        $this->load->view('js/js_miskin', array(
            'chart' => 'kemiskinan/chart_pkh'
                )
        );
    }

    function chart_pkh() {
        $this->load->model('kemiskinan_model');
        $id_kec = $this->input->post('id_kecamatan');
        $id_kel = $this->input->post('id_kelurahan');
        $query = $this->kemiskinan_model->getChartPKH($id_kec, $id_kel);
        $subtitle = array("BANYUWANGI");
        $kec = $this->penduduk_model->get_kec_nama($id_kec);
        if (strlen($kec) > 0) {
            $subtitle[] = $kec;
            $kel = $this->penduduk_model->get_kel_nama($id_kec, $id_kel);
            if (strlen($kel)) {
                $subtitle[] = $kel;
            }
        }
        $this->load->view('chart/pie', array(
            'data' => $query,
            'judul' => 'Jumlah KK Miskin berdasarkan Keikutsertaan PKH',
            'subtitle' => $subtitle,
            'kolom' => 'Keikutsertaan PKH',
            'id_kecamatan' => $id_kec,
            'controller' => 'kemiskinan/lihat_pkh'
                )
        );
    }

    function raskin() {
        $this->load->view('theme/header');
        $this->load->view('theme/sidebar_miskin2');
        $this->load->view('kemiskinan/v', array('list_kecamatan' => $this->penduduk_model->get_list_kecamatan()));
        $this->load->view('theme/footer');
        $this->load->view('js/js_miskin', array(
            'chart' => 'kemiskinan/chart_raskin'
                )
        );
    }

    function chart_raskin() {
        $this->load->model('kemiskinan_model');
        $id_kec = $this->input->post('id_kecamatan');
        $id_kel = $this->input->post('id_kelurahan');
        $query = $this->kemiskinan_model->getChartRaskin($id_kec, $id_kel);
        $subtitle = array("BANYUWANGI");
        $kec = $this->penduduk_model->get_kec_nama($id_kec);
        if (strlen($kec) > 0) {
            $subtitle[] = $kec;
            $kel = $this->penduduk_model->get_kel_nama($id_kec, $id_kel);
            if (strlen($kel)) {
                $subtitle[] = $kel;
            }
        }
        $this->load->view('chart/pie', array(
            'data' => $query,
            'judul' => 'Jumlah KK Miskin berdasarkan Keikutsertaan Raskin',
            'subtitle' => $subtitle,
            'kolom' => 'Keikutsertaan Raskin',
            'id_kecamatan' => $id_kec,
            'controller' => 'kemiskinan/lihat_raskin'
                )
        );
    }

    function jamkesmas() {
        $this->load->view('theme/header');
        $this->load->view('theme/sidebar_miskin2');
        $this->load->view('kemiskinan/v', array('list_kecamatan' => $this->penduduk_model->get_list_kecamatan()));
        $this->load->view('theme/footer');
        $this->load->view('js/js_miskin', array(
            'chart' => 'kemiskinan/chart_jamkesmas'
                )
        );
    }

    function chart_jamkesmas() {
        $this->load->model('kemiskinan_model');
        $id_kec = $this->input->post('id_kecamatan');
        $id_kel = $this->input->post('id_kelurahan');
        $query = $this->kemiskinan_model->getChartJamkesmas($id_kec, $id_kel);
        $subtitle = array("BANYUWANGI");
        $kec = $this->penduduk_model->get_kec_nama($id_kec);
        if (strlen($kec) > 0) {
            $subtitle[] = $kec;
            $kel = $this->penduduk_model->get_kel_nama($id_kec, $id_kel);
            if (strlen($kel)) {
                $subtitle[] = $kel;
            }
        }
        $this->load->view('chart/pie', array(
            'data' => $query,
            'judul' => 'Jumlah KK Miskin berdasarkan Keikutsertaan JAMKESMAS',
            'subtitle' => $subtitle,
            'kolom' => 'Keikutsertaan JAMKESMAS',
            'id_kecamatan' => $id_kec,
            'controller' => 'kemiskinan/lihat_jamkesmas'
                )
        );
    }

    function askes() {
        $this->load->view('theme/header');
        $this->load->view('theme/sidebar_miskin2');
        $this->load->view('kemiskinan/v', array('list_kecamatan' => $this->penduduk_model->get_list_kecamatan()));
        $this->load->view('theme/footer');
        $this->load->view('js/js_miskin', array(
            'chart' => 'kemiskinan/chart_askes'
                )
        );
    }

    function chart_askes() {
        $this->load->model('kemiskinan_model');
        $id_kec = $this->input->post('id_kecamatan');
        $id_kel = $this->input->post('id_kelurahan');
        $query = $this->kemiskinan_model->getChartAskes($id_kec, $id_kel);
        $subtitle = array("BANYUWANGI");
        $kec = $this->penduduk_model->get_kec_nama($id_kec);
        if (strlen($kec) > 0) {
            $subtitle[] = $kec;
            $kel = $this->penduduk_model->get_kel_nama($id_kec, $id_kel);
            if (strlen($kel)) {
                $subtitle[] = $kel;
            }
        }
        $this->load->view('chart/pie', array(
            'data' => $query,
            'judul' => 'Jumlah KK Miskin berdasarkan Keikutsertaan ASKES',
            'subtitle' => $subtitle,
            'kolom' => 'Keikutsertaan ASKES',
            'id_kecamatan' => $id_kec,
            'controller' => 'kemiskinan/lihat_askes'
                )
        );
    }

    function jamsostek() {
        $this->load->view('theme/header');
        $this->load->view('theme/sidebar_miskin2');
        $this->load->view('kemiskinan/v', array('list_kecamatan' => $this->penduduk_model->get_list_kecamatan()));
        $this->load->view('theme/footer');
        $this->load->view('js/js_miskin', array(
            'chart' => 'kemiskinan/chart_jamsostek'
                )
        );
    }

    function chart_jamsostek() {
        $this->load->model('kemiskinan_model');
        $id_kec = $this->input->post('id_kecamatan');
        $id_kel = $this->input->post('id_kelurahan');
        $query = $this->kemiskinan_model->getChartJamsostek($id_kec, $id_kel);
        $subtitle = array("BANYUWANGI");
        $kec = $this->penduduk_model->get_kec_nama($id_kec);
        if (strlen($kec) > 0) {
            $subtitle[] = $kec;
            $kel = $this->penduduk_model->get_kel_nama($id_kec, $id_kel);
            if (strlen($kel)) {
                $subtitle[] = $kel;
            }
        }
        $this->load->view('chart/pie', array(
            'data' => $query,
            'judul' => 'Jumlah KK Miskin berdasarkan Keikutsertaan JAMSOSTEK',
            'subtitle' => $subtitle,
            'kolom' => 'Keikutsertaan JAMSOSTEK',
            'id_kecamatan' => $id_kec,
            'controller' => 'kemiskinan/lihat_jamsostek'
                )
        );
    }

    function kb() {
        $this->load->view('theme/header');
        $this->load->view('theme/sidebar_miskin2');
        $this->load->view('kemiskinan/v', array('list_kecamatan' => $this->penduduk_model->get_list_kecamatan()));
        $this->load->view('theme/footer');
        $this->load->view('js/js_miskin', array(
            'chart' => 'kemiskinan/chart_kb'
                )
        );
    }

    function chart_kb() {
        $this->load->model('kemiskinan_model');
        $id_kec = $this->input->post('id_kecamatan');
        $id_kel = $this->input->post('id_kelurahan');
        $query = $this->kemiskinan_model->getChartKB($id_kec, $id_kel);
        $subtitle = array("BANYUWANGI");
        $kec = $this->penduduk_model->get_kec_nama($id_kec);
        if (strlen($kec) > 0) {
            $subtitle[] = $kec;
            $kel = $this->penduduk_model->get_kel_nama($id_kec, $id_kel);
            if (strlen($kel)) {
                $subtitle[] = $kel;
            }
        }
        $this->load->view('chart/pie', array(
            'data' => $query,
            'judul' => 'Jumlah KK Miskin berdasarkan Keikutsertaan KB',
            'subtitle' => $subtitle,
            'kolom' => 'Keikutsertaan KB',
            'id_kecamatan' => $id_kec,
            'controller' => 'kemiskinan/lihat_kb'
                )
        );
    }

    function beasiswa_miskin() {
        $this->load->view('theme/header');
        $this->load->view('theme/sidebar_miskin2');
        $this->load->view('kemiskinan/v', array('list_kecamatan' => $this->penduduk_model->get_list_kecamatan()));
        $this->load->view('theme/footer');
        $this->load->view('js/js_miskin', array(
            'chart' => 'kemiskinan/chart_beasiswa_miskin'
                )
        );
    }

    function chart_beasiswa_miskin() {
        $this->load->model('kemiskinan_model');
        $id_kec = $this->input->post('id_kecamatan');
        $id_kel = $this->input->post('id_kelurahan');
        $query = $this->kemiskinan_model->getChartBeasiswaMiskin($id_kec, $id_kel);
        $subtitle = array("BANYUWANGI");
        $kec = $this->penduduk_model->get_kec_nama($id_kec);
        if (strlen($kec) > 0) {
            $subtitle[] = $kec;
            $kel = $this->penduduk_model->get_kel_nama($id_kec, $id_kel);
            if (strlen($kel)) {
                $subtitle[] = $kel;
            }
        }
        $this->load->view('chart/pie', array(
            'data' => $query,
            'judul' => 'Jumlah KK Miskin berdasarkan Keikutsertaan Beasiswa Miskin',
            'subtitle' => $subtitle,
            'kolom' => 'Keikutsertaan Beasiswa Miskin',
            'id_kecamatan' => $id_kec,
            'controller' => 'kemiskinan/lihat_beasiswa_miskin'
                )
        );
    }

    function blsm() {
        $this->load->view('theme/header');
        $this->load->view('theme/sidebar_miskin2');
        $this->load->view('kemiskinan/v', array('list_kecamatan' => $this->penduduk_model->get_list_kecamatan()));
        $this->load->view('theme/footer');
        $this->load->view('js/js_miskin', array(
            'chart' => 'kemiskinan/chart_blsm'
                )
        );
    }

    function chart_blsm() {
        $this->load->model('kemiskinan_model');
        $id_kec = $this->input->post('id_kecamatan');
        $id_kel = $this->input->post('id_kelurahan');
        $query = $this->kemiskinan_model->getChartBlsm($id_kec, $id_kel);
        $subtitle = array("BANYUWANGI");
        $kec = $this->penduduk_model->get_kec_nama($id_kec);
        if (strlen($kec) > 0) {
            $subtitle[] = $kec;
            $kel = $this->penduduk_model->get_kel_nama($id_kec, $id_kel);
            if (strlen($kel)) {
                $subtitle[] = $kel;
            }
        }
        $this->load->view('chart/pie', array(
            'data' => $query,
            'judul' => 'Jumlah KK Miskin berdasarkan Keikutsertaan BLSM',
            'subtitle' => $subtitle,
            'kolom' => 'Keikutsertaan BLSM',
            'id_kecamatan' => $id_kec,
            'controller' => 'kemiskinan/lihat_blsm'
                )
        );
    }

    function spm() {
        $this->load->view('theme/header');
        $this->load->view('theme/sidebar_miskin2');
        $this->load->view('kemiskinan/v', array('list_kecamatan' => $this->penduduk_model->get_list_kecamatan()));
        $this->load->view('theme/footer');
        $this->load->view('js/js_miskin', array(
            'chart' => 'kemiskinan/chart_spm'
                )
        );
    }

    function chart_spm() {
        $this->load->model('kemiskinan_model');
        $id_kec = $this->input->post('id_kecamatan');
        $id_kel = $this->input->post('id_kelurahan');
        $query = $this->kemiskinan_model->getChartSPM($id_kec, $id_kel);
        $subtitle = array("BANYUWANGI");
        $kec = $this->penduduk_model->get_kec_nama($id_kec);
        if (strlen($kec) > 0) {
            $subtitle[] = $kec;
            $kel = $this->penduduk_model->get_kel_nama($id_kec, $id_kel);
            if (strlen($kel)) {
                $subtitle[] = $kel;
            }
        }
        $this->load->view('chart/pie', array(
            'data' => $query,
            'judul' => 'Jumlah KK Miskin berdasarkan Keikutsertaan SPM',
            'subtitle' => $subtitle,
            'kolom' => 'Keikutsertaan SPM',
            'id_kecamatan' => $id_kec,
            'controller' => 'kemiskinan/lihat_spm'
                )
        );
    }

    function jampersal() {
        $this->load->view('theme/header');
        $this->load->view('theme/sidebar_miskin2');
        $this->load->view('kemiskinan/v', array('list_kecamatan' => $this->penduduk_model->get_list_kecamatan()));
        $this->load->view('theme/footer');
        $this->load->view('js/js_miskin', array(
            'chart' => 'kemiskinan/chart_jampersal'
                )
        );
    }

    function chart_jampersal() {
        $this->load->model('kemiskinan_model');
        $id_kec = $this->input->post('id_kecamatan');
        $id_kel = $this->input->post('id_kelurahan');
        $query = $this->kemiskinan_model->getChartJampersal($id_kec, $id_kel);
        $subtitle = array("BANYUWANGI");
        $kec = $this->penduduk_model->get_kec_nama($id_kec);
        if (strlen($kec) > 0) {
            $subtitle[] = $kec;
            $kel = $this->penduduk_model->get_kel_nama($id_kec, $id_kel);
            if (strlen($kel)) {
                $subtitle[] = $kel;
            }
        }
        $this->load->view('chart/pie', array(
            'data' => $query,
            'judul' => 'Jumlah KK Miskin berdasarkan Keikutsertaan JAMPERSAL',
            'subtitle' => $subtitle,
            'kolom' => 'Keikutsertaan JAMPERSAL',
            'id_kecamatan' => $id_kec,
            'controller' => 'kemiskinan/lihat_jampersal'
                )
        );
    }

    function bedah_rumah() {
        $this->load->view('theme/header');
        $this->load->view('theme/sidebar_miskin2');
        $this->load->view('kemiskinan/v', array('list_kecamatan' => $this->penduduk_model->get_list_kecamatan()));
        $this->load->view('theme/footer');
        $this->load->view('js/js_miskin', array(
            'chart' => 'kemiskinan/chart_bedah_rumah'
                )
        );
    }

    function chart_bedah_rumah() {
        $this->load->model('kemiskinan_model');
        $id_kec = $this->input->post('id_kecamatan');
        $id_kel = $this->input->post('id_kelurahan');
        $query = $this->kemiskinan_model->getChartBedahRumah($id_kec, $id_kel);
        $subtitle = array("BANYUWANGI");
        $kec = $this->penduduk_model->get_kec_nama($id_kec);
        if (strlen($kec) > 0) {
            $subtitle[] = $kec;
            $kel = $this->penduduk_model->get_kel_nama($id_kec, $id_kel);
            if (strlen($kel)) {
                $subtitle[] = $kel;
            }
        }
        $this->load->view('chart/pie', array(
            'data' => $query,
            'judul' => 'Jumlah KK Miskin berdasarkan Keikutsertaan Bedah Rumah',
            'subtitle' => $subtitle,
            'kolom' => 'Keikutsertaan Bedah Rumah',
            'id_kecamatan' => $id_kec,
            'controller' => 'kemiskinan/lihat_bedah_rumah'
                )
        );
    }

    function program_lain() {
        $this->load->view('theme/header');
        $this->load->view('theme/sidebar_miskin2');
        $this->load->view('kemiskinan/v', array('list_kecamatan' => $this->penduduk_model->get_list_kecamatan()));
        $this->load->view('theme/footer');
        $this->load->view('js/js_miskin', array(
            'chart' => 'kemiskinan/chart_program_lain'
                )
        );
    }

    function chart_program_lain() {
        $this->load->model('kemiskinan_model');
        $id_kec = $this->input->post('id_kecamatan');
        $id_kel = $this->input->post('id_kelurahan');
        $query = $this->kemiskinan_model->getChartProgramLain($id_kec, $id_kel);
        $subtitle = array("BANYUWANGI");
        $kec = $this->penduduk_model->get_kec_nama($id_kec);
        if (strlen($kec) > 0) {
            $subtitle[] = $kec;
            $kel = $this->penduduk_model->get_kel_nama($id_kec, $id_kel);
            if (strlen($kel)) {
                $subtitle[] = $kel;
            }
        }
        $this->load->view('chart/pie', array(
            'data' => $query,
            'judul' => 'Jumlah KK Miskin berdasarkan Keikutsertaan Program Lain-lain',
            'subtitle' => $subtitle,
            'kolom' => 'Keikutsertaan Program Lain-lain',
            'id_kecamatan' => $id_kec,
            'controller' => 'kemiskinan/lihat_program_lain'
                )
        );
    }

    function lihat_status_dalam_keluarga() {
        $session = $this->session->userdata('login');
        if ($session == NULL) {
            redirect(site_url() . '/login');
            exit();
        }
        $kunci = (int) $this->input->get('key');
        $limit = (int) $this->input->get('limit');
        $halaman = (int) $this->input->get('halaman');
        $id_kecamatan = (int) $this->input->get('id_kecamatan');
        $id_kelurahan = (int) $this->input->get('id_kelurahan');

        if ($limit > 1000) {
            $limit = 1000;
        } else if ($limit < 10) {
            $limit = 10;
        }
        $this->load->model('kemiskinan_model');
        $jumlah_data = $this->kemiskinan_model->get_jumlah_data($kunci, $id_kecamatan, $id_kelurahan, 'hubungan_kk');
        $max_halaman = floor($jumlah_data / $limit);
        if ($halaman < 0) {
            $halaman = 0;
        } else if ($halaman > $max_halaman) {
            $halaman = $max_halaman;
        }

        $list_data = $this->kemiskinan_model->get_data_penduduk($kunci, $limit, $halaman * $limit, $id_kecamatan, $id_kelurahan, 'hubungan_kk');
        $this->load->view('theme/header');
        $this->load->view('theme/sidebar_miskin');
        $list_kecamatan = $this->penduduk_model->get_list_kecamatan();
        $list_kelurahan = $this->kemiskinan_model->get_list_kelurahan($id_kecamatan);
        $list_kategori = $this->kemiskinan_model->get_list_master('miskin_master_hubungan_kk');
        $this->load->view('kemiskinan/v_list', array(
            'list_kecamatan' => $list_kecamatan,
            'list_kelurahan' => $list_kelurahan,
            'list_kategori' => $list_kategori,
            'semua_kategori' => 'Semua Status',
            'list_data' => $list_data,
            'id_kecamatan' => $id_kecamatan,
            'id_kelurahan' => $id_kelurahan,
            'key' => $kunci,
            'controller' => 'kemiskinan/lihat_status_dalam_keluarga',
            'limit' => $limit,
            'halaman' => $halaman,
            'jumlah_halaman' => $max_halaman,
            'table_header' => 'Status'
                )
        );
    }

    function lihat_status_cacat() {
        $session = $this->session->userdata('login');
        if ($session == NULL) {
            redirect(site_url() . '/login');
            exit();
        }
        $kunci = (int) $this->input->get('key');
        $limit = (int) $this->input->get('limit');
        $halaman = (int) $this->input->get('halaman');
        $id_kecamatan = (int) $this->input->get('id_kecamatan');
        $id_kelurahan = (int) $this->input->get('id_kelurahan');

        if ($limit > 1000) {
            $limit = 1000;
        } else if ($limit < 10) {
            $limit = 10;
        }
        $this->load->model('kemiskinan_model');
        $jumlah_data = $this->kemiskinan_model->get_jumlah_data($kunci, $id_kecamatan, $id_kelurahan, 'jenis_cacat');
        $max_halaman = floor($jumlah_data / $limit);
        if ($halaman < 0) {
            $halaman = 0;
        } else if ($halaman > $max_halaman) {
            $halaman = $max_halaman;
        }

        $list_data = $this->kemiskinan_model->get_data_penduduk($kunci, $limit, $halaman * $limit, $id_kecamatan, $id_kelurahan, 'jenis_cacat');
        $this->load->view('theme/header');
        $this->load->view('theme/sidebar_miskin');
        $list_kecamatan = $this->penduduk_model->get_list_kecamatan();
        $list_kelurahan = $this->kemiskinan_model->get_list_kelurahan($id_kecamatan);
        $list_kategori = $this->kemiskinan_model->get_list_master('miskin_master_jenis_cacat');
        $this->load->view('kemiskinan/v_list', array(
            'list_kecamatan' => $list_kecamatan,
            'list_kelurahan' => $list_kelurahan,
            'list_kategori' => $list_kategori,
            'semua_kategori' => 'Semua Jenis Cacat',
            'list_data' => $list_data,
            'id_kecamatan' => $id_kecamatan,
            'id_kelurahan' => $id_kelurahan,
            'key' => $kunci,
            'controller' => 'kemiskinan/lihat_status_cacat',
            'limit' => $limit,
            'halaman' => $halaman,
            'jumlah_halaman' => $max_halaman,
            'table_header' => 'Jenis Cacat'
                )
        );
    }

    function lihat_aksara() {
        $session = $this->session->userdata('login');
        if ($session == NULL) {
            redirect(site_url() . '/login');
            exit();
        }
        $kunci = (int) $this->input->get('key');
        $limit = (int) $this->input->get('limit');
        $halaman = (int) $this->input->get('halaman');
        $id_kecamatan = (int) $this->input->get('id_kecamatan');
        $id_kelurahan = (int) $this->input->get('id_kelurahan');

        if ($limit > 1000) {
            $limit = 1000;
        } else if ($limit < 10) {
            $limit = 10;
        }
        $this->load->model('kemiskinan_model');
        $jumlah_data = $this->kemiskinan_model->get_jumlah_data($kunci, $id_kecamatan, $id_kelurahan, 'keaksaraan');
        $max_halaman = floor($jumlah_data / $limit);
        if ($halaman < 0) {
            $halaman = 0;
        } else if ($halaman > $max_halaman) {
            $halaman = $max_halaman;
        }

        $list_data = $this->kemiskinan_model->get_data_penduduk($kunci, $limit, $halaman * $limit, $id_kecamatan, $id_kelurahan, 'keaksaraan');
        $this->load->view('theme/header');
        $this->load->view('theme/sidebar_miskin');
        $list_kecamatan = $this->penduduk_model->get_list_kecamatan();
        $list_kelurahan = $this->kemiskinan_model->get_list_kelurahan($id_kecamatan);
        $list_kategori = $this->kemiskinan_model->get_list_master('miskin_master_yatidak', 'ket2');
        $this->load->view('kemiskinan/v_list', array(
            'list_kecamatan' => $list_kecamatan,
            'list_kelurahan' => $list_kelurahan,
            'list_kategori' => $list_kategori,
            'semua_kategori' => 'Semua Keaksaraan',
            'list_data' => $list_data,
            'id_kecamatan' => $id_kecamatan,
            'id_kelurahan' => $id_kelurahan,
            'key' => $kunci,
            'controller' => 'kemiskinan/lihat_aksara',
            'limit' => $limit,
            'halaman' => $halaman,
            'jumlah_halaman' => $max_halaman,
            'table_header' => 'Status Keaksaraan'
                )
        );
    }

    function lihat_kepemilikan_kartu_id() {
        $session = $this->session->userdata('login');
        if ($session == NULL) {
            redirect(site_url() . '/login');
            exit();
        }
        $kunci = (int) $this->input->get('key');
        $limit = (int) $this->input->get('limit');
        $halaman = (int) $this->input->get('halaman');
        $id_kecamatan = (int) $this->input->get('id_kecamatan');
        $id_kelurahan = (int) $this->input->get('id_kelurahan');

        if ($limit > 1000) {
            $limit = 1000;
        } else if ($limit < 10) {
            $limit = 10;
        }
        $this->load->model('kemiskinan_model');
        $jumlah_data = $this->kemiskinan_model->get_jumlah_data($kunci, $id_kecamatan, $id_kelurahan, 'kepemilikan_kartu_identitas');
        $max_halaman = floor($jumlah_data / $limit);
        if ($halaman < 0) {
            $halaman = 0;
        } else if ($halaman > $max_halaman) {
            $halaman = $max_halaman;
        }

        $list_data = $this->kemiskinan_model->get_data_penduduk($kunci, $limit, $halaman * $limit, $id_kecamatan, $id_kelurahan, 'kepemilikan_kartu_identitas');
        $this->load->view('theme/header');
        $this->load->view('theme/sidebar_miskin');
        $list_kecamatan = $this->penduduk_model->get_list_kecamatan();
        $list_kelurahan = $this->kemiskinan_model->get_list_kelurahan($id_kecamatan);
        $list_kategori = $this->kemiskinan_model->get_list_master('miskin_master_kartu_id');
        $this->load->view('kemiskinan/v_list', array(
            'list_kecamatan' => $list_kecamatan,
            'list_kelurahan' => $list_kelurahan,
            'list_kategori' => $list_kategori,
            'semua_kategori' => 'Semua Kartu Identitas',
            'list_data' => $list_data,
            'id_kecamatan' => $id_kecamatan,
            'id_kelurahan' => $id_kelurahan,
            'key' => $kunci,
            'controller' => 'kemiskinan/lihat_kepemilikan_kartu_id',
            'limit' => $limit,
            'halaman' => $halaman,
            'jumlah_halaman' => $max_halaman,
            'table_header' => 'Kartu Identitas'
                )
        );
    }

    function lihat_partisipasi_sekolah() {
        $session = $this->session->userdata('login');
        if ($session == NULL) {
            redirect(site_url() . '/login');
            exit();
        }
        $kunci = (int) $this->input->get('key');
        $limit = (int) $this->input->get('limit');
        $halaman = (int) $this->input->get('halaman');
        $id_kecamatan = (int) $this->input->get('id_kecamatan');
        $id_kelurahan = (int) $this->input->get('id_kelurahan');

        if ($limit > 1000) {
            $limit = 1000;
        } else if ($limit < 10) {
            $limit = 10;
        }
        $this->load->model('kemiskinan_model');
        $jumlah_data = $this->kemiskinan_model->get_jumlah_data($kunci, $id_kecamatan, $id_kelurahan, 'partisipasi_sekolah');
        $max_halaman = floor($jumlah_data / $limit);
        if ($halaman < 0) {
            $halaman = 0;
        } else if ($halaman > $max_halaman) {
            $halaman = $max_halaman;
        }

        $list_data = $this->kemiskinan_model->get_data_penduduk($kunci, $limit, $halaman * $limit, $id_kecamatan, $id_kelurahan, 'partisipasi_sekolah');
        $this->load->view('theme/header');
        $this->load->view('theme/sidebar_miskin');
        $list_kecamatan = $this->penduduk_model->get_list_kecamatan();
        $list_kelurahan = $this->kemiskinan_model->get_list_kelurahan($id_kecamatan);
        $list_kategori = $this->kemiskinan_model->get_list_master('miskin_master_partisipasi_sekolah');
        $this->load->view('kemiskinan/v_list', array(
            'list_kecamatan' => $list_kecamatan,
            'list_kelurahan' => $list_kelurahan,
            'list_kategori' => $list_kategori,
            'semua_kategori' => 'Semua Partisipasi Sekolah',
            'list_data' => $list_data,
            'id_kecamatan' => $id_kecamatan,
            'id_kelurahan' => $id_kelurahan,
            'key' => $kunci,
            'controller' => 'kemiskinan/lihat_partisipasi_sekolah',
            'limit' => $limit,
            'halaman' => $halaman,
            'jumlah_halaman' => $max_halaman,
            'table_header' => 'Partisipasi Sekolah'
                )
        );
    }

    function lihat_penyakit_kronis() {
        $session = $this->session->userdata('login');
        if ($session == NULL) {
            redirect(site_url() . '/login');
            exit();
        }
        $kunci = (int) $this->input->get('key');
        $limit = (int) $this->input->get('limit');
        $halaman = (int) $this->input->get('halaman');
        $id_kecamatan = (int) $this->input->get('id_kecamatan');
        $id_kelurahan = (int) $this->input->get('id_kelurahan');

        if ($limit > 1000) {
            $limit = 1000;
        } else if ($limit < 10) {
            $limit = 10;
        }
        $this->load->model('kemiskinan_model');
        $jumlah_data = $this->kemiskinan_model->get_jumlah_data($kunci, $id_kecamatan, $id_kelurahan, 'penyakit_kronis');
        $max_halaman = floor($jumlah_data / $limit);
        if ($halaman < 0) {
            $halaman = 0;
        } else if ($halaman > $max_halaman) {
            $halaman = $max_halaman;
        }

        $list_data = $this->kemiskinan_model->get_data_penduduk($kunci, $limit, $halaman * $limit, $id_kecamatan, $id_kelurahan, 'penyakit_kronis');
        $this->load->view('theme/header');
        $this->load->view('theme/sidebar_miskin');
        $list_kecamatan = $this->penduduk_model->get_list_kecamatan();
        $list_kelurahan = $this->kemiskinan_model->get_list_kelurahan($id_kecamatan);
        $list_kategori = $this->kemiskinan_model->get_list_master('miskin_master_penyakit_kronis');
        $this->load->view('kemiskinan/v_list', array(
            'list_kecamatan' => $list_kecamatan,
            'list_kelurahan' => $list_kelurahan,
            'list_kategori' => $list_kategori,
            'semua_kategori' => 'Semua Penyakit Kronis',
            'list_data' => $list_data,
            'id_kecamatan' => $id_kecamatan,
            'id_kelurahan' => $id_kelurahan,
            'key' => $kunci,
            'controller' => 'kemiskinan/lihat_penyakit_kronis',
            'limit' => $limit,
            'halaman' => $halaman,
            'jumlah_halaman' => $max_halaman,
            'table_header' => 'Penyakit'
                )
        );
    }

    function lihat_tempat_tinggal() {
        $this->lihat_rt('status_tempat_tinggal', 'miskin_master_status_kepemilikan_rumah', 'Semua Jenis Kepemilikan', 'Jenis Kepemilikan', 'kemiskinan/lihat_tempat_tinggal');
    }

    function lihat_luas_tanah() {
        $session = $this->session->userdata('login');
        if ($session == NULL) {
            redirect(site_url() . '/login');
            exit();
        }
        $kunci = (int)$this->input->get('key');
        $min = (int) $this->input->get('min');
        $max = (int) $this->input->get('max');
        $limit = (int) $this->input->get('limit');
        $halaman = (int) $this->input->get('halaman');
        $id_kecamatan = (int) $this->input->get('id_kecamatan');
        $id_kelurahan = (int) $this->input->get('id_kelurahan');

        if ($limit > 1000) {
            $limit = 1000;
        } else if ($limit < 10) {
            $limit = 10;
        }
        $this->load->model('kemiskinan_model');
        $jumlah_data = $this->kemiskinan_model->get_jumlah_data_rt_tanah($min,$max, $id_kecamatan, $id_kelurahan);
        $max_halaman = floor($jumlah_data / $limit);
        if ($halaman < 0) {
            $halaman = 0;
        } else if ($halaman > $max_halaman) {
            $halaman = $max_halaman;
        }

        $list_data = $this->kemiskinan_model->get_data_rt_tanah($min,$max, $limit, $halaman * $limit, $id_kecamatan, $id_kelurahan);
        $this->load->view('theme/header');
        $this->load->view('theme/sidebar_miskin');
        $list_kecamatan = $this->penduduk_model->get_list_kecamatan();
        $list_kelurahan = $this->kemiskinan_model->get_list_kelurahan($id_kecamatan);
        $list_kategori = $this->kemiskinan_model->get_list_master_luas_tanah();
        $this->load->view('kemiskinan/v_rt_tanah', array(
            'list_kecamatan' => $list_kecamatan,
            'list_kelurahan' => $list_kelurahan,
            'list_kategori' => $list_kategori,
            'semua_kategori' => 'Semua Luas Tanah',
            'list_data' => $list_data,
            'id_kecamatan' => $id_kecamatan,
            'id_kelurahan' => $id_kelurahan,
            'key' => $kunci,
            'controller' => 'kemiskinan/lihat_luas_tanah',
            'limit' => $limit,
            'halaman' => $halaman,
            'jumlah_halaman' => $max_halaman,
            'table_header' => 'Luas Tanah',
            'min'=>$min,
            'max'=>$max
                )
        );
    }

    function lihat_jenis_lantai() {
        $this->lihat_rt('jenis_lantai', 'miskin_master_jenis_lantai', 'Semua Jenis Lantai', 'Jenis Lantai', 'kemiskinan/lihat_jenis_lantai');
    }

    function lihat_jenis_dinding() {
        $this->lihat_rt('jenis_dinding', 'miskin_master_jenis_dinding', 'Semua Jenis Dinding', 'Jenis Dinding', 'kemiskinan/lihat_jenis_dinding');
    }

    private function lihat_rt($kolom_filter, $table_master, $all_kategori, $nama_kategori, $controller, $kolom_master = 'ket') {
        $session = $this->session->userdata('login');
        if ($session == NULL) {
            redirect(site_url() . '/login');
            exit();
        }
        $kunci = (int) $this->input->get('key');
        $limit = (int) $this->input->get('limit');
        $halaman = (int) $this->input->get('halaman');
        $id_kecamatan = (int) $this->input->get('id_kecamatan');
        $id_kelurahan = (int) $this->input->get('id_kelurahan');

        if ($limit > 1000) {
            $limit = 1000;
        } else if ($limit < 10) {
            $limit = 10;
        }
        $this->load->model('kemiskinan_model');
        $jumlah_data = $this->kemiskinan_model->get_jumlah_data_rt($kunci, $id_kecamatan, $id_kelurahan, $kolom_filter);
        $max_halaman = floor($jumlah_data / $limit);
        if ($halaman < 0) {
            $halaman = 0;
        } else if ($halaman > $max_halaman) {
            $halaman = $max_halaman;
        }

        $list_data = $this->kemiskinan_model->get_data_rt($kunci, $limit, $halaman * $limit, $id_kecamatan, $id_kelurahan, $kolom_filter);
        $this->load->view('theme/header');
        $this->load->view('theme/sidebar_miskin');
        $list_kecamatan = $this->penduduk_model->get_list_kecamatan();
        $list_kelurahan = $this->kemiskinan_model->get_list_kelurahan($id_kecamatan);
        $list_kategori = $this->kemiskinan_model->get_list_master($table_master, $kolom_master);
        $this->load->view('kemiskinan/v_rt', array(
            'list_kecamatan' => $list_kecamatan,
            'list_kelurahan' => $list_kelurahan,
            'list_kategori' => $list_kategori,
            'semua_kategori' => $all_kategori,
            'list_data' => $list_data,
            'id_kecamatan' => $id_kecamatan,
            'id_kelurahan' => $id_kelurahan,
            'key' => $kunci,
            'controller' => $controller,
            'limit' => $limit,
            'halaman' => $halaman,
            'jumlah_halaman' => $max_halaman,
            'table_header' => $nama_kategori
                )
        );
        $this->load->view('theme/footer');
    }

    function lihat_jenis_atap() {
        $this->lihat_rt('jenis_atap', 'miskin_master_jenis_atap', 'Semua Jenis Atap', 'Jenis Atap', 'kemiskinan/lihat_jenis_atap');
    }

    function lihat_sumber_minum() {
        $this->lihat_rt('sumber_air_minum', 'miskin_master_sumber_minum', 'Semua Sumber Air Minum', 'Sumber Air Minum', 'kemiskinan/lihat_sumber_minum');
    }

    function lihat_cara_dapat_minum() {
        $this->lihat_rt('cara_memperoleh_air_minum', 'miskin_master_cara_dapat_minum', 'Semua Cara Mendapatkan Air Minum', 'Cara Mendapatkan Air Minum', 'kemiskinan/lihat_cara_dapat_minum');
    }

    function lihat_sumber_penerangan() {
        $this->lihat_rt('sumber_penerangan', 'miskin_master_sumber_penerangan', 'Semua Sumber Penerangan', 'Sumber Penerangan', 'kemiskinan/lihat_sumber_penerangan');
    }

    function lihat_energi_memasak() {
        $this->lihat_rt('energi_memasak', 'miskin_master_energi_memasak', 'Semua Sumber Energi', 'Sumber Energi', 'kemiskinan/lihat_energi_memasak');
    }

    function lihat_fasilitas_bab() {
        $this->lihat_rt('penggunaan_fasilitas_bab', 'miskin_master_penggunaan_fasilitas_bab', 'Semua Fasilitas BAB', 'Fasilitas BAB', 'kemiskinan/lihat_fasilitas_bab');
    }

    function lihat_pembuangan_bab() {
        $this->lihat_rt('tempat_pembuangan_tinja', 'miskin_master_tempat_pembuangan_tinja', 'Semua Tempat Pembuangan', 'Tempat Pembuangan', 'kemiskinan/lihat_pembuangan_bab');
    }

    function lihat_merokok() {
        $this->lihat_rt('merokok', 'miskin_master_yatidak', 'Semua Status Merokok', 'Status Merokok', 'kemiskinan/lihat_merokok', 'ket2');
    }

    function lihat_mobil() {
        $this->lihat_rt('punya_mobil', 'miskin_master_yatidak', 'Semua Status Punya Mobil', 'Punya Mobil', 'kemiskinan/lihat_mobil');
    }

    function lihat_kapal_motor() {
        $this->lihat_rt('punya_kapal_motor', 'miskin_master_yatidak', 'Semua Status Punya Kapal Motor', 'Punya Kapal Motor', 'kemiskinan/lihat_kapal_motor');
    }

    function lihat_perahu_motor() {
        $this->lihat_rt('punya_perahu_motor', 'miskin_master_yatidak', 'Semua Status Punya Perahu Motor', 'Punya Perahu Motor', 'kemiskinan/lihat_perahu_motor');
    }

    function lihat_sepeda_motor() {
        $this->lihat_rt('punya_sepeda_motor', 'miskin_master_yatidak', 'Semua Status Punya Sepeda Motor', 'Punya Sepeda Motor', 'kemiskinan/lihat_sepeda_motor');
    }

    function lihat_sepeda() {
        $this->lihat_rt('punya_sepeda', 'miskin_master_yatidak', 'Semua Status Punya Sepeda', 'Punya Sepeda', 'kemiskinan/lihat_sepeda');
    }

    function lihat_perahu() {
        $this->lihat_rt('punya_perahu', 'miskin_master_yatidak', 'Semua Status Punya Perahu', 'Punya Perahu', 'kemiskinan/lihat_perahu');
    }

    function lihat_kulkas() {
        $this->lihat_rt('punya_kulkas', 'miskin_master_yatidak', 'Semua Status Punya Kulkas', 'Punya Kulkas', 'kemiskinan/lihat_kulkas');
    }

    function lihat_elpiji() {
        $this->lihat_rt('punya_lpg', 'miskin_master_yatidak', 'Semua Status Punya LPG', 'Punya LPG', 'kemiskinan/lihat_elpiji');
    }

    function lihat_hape() {
        $this->lihat_rt('punya_hp', 'miskin_master_yatidak', 'Semua Status Punya HP', 'Punya HP', 'kemiskinan/lihat_hape');
    }

    function lihat_pkh() {
        $this->lihat_rt('ikut_pkh', 'miskin_master_yatidak', 'Semua Status Ikut Serta PKH', 'Ikut PKH', 'kemiskinan/lihat_pkh');
    }

    function lihat_raskin() {
        $this->lihat_rt('ikut_raskin', 'miskin_master_yatidak', 'Semua Status Menerima RasKin', 'Menerima RasKin', 'kemiskinan/lihat_raskin');
    }

    function lihat_jamkesmas() {
        $this->lihat_rt('ikut_jamkesmas', 'miskin_master_yatidak', 'Semua Status Ikut JAMKESMAS', 'Ikut JAMKESMAS', 'kemiskinan/lihat_jamkesmas');
    }

    function lihat_askes() {
        $this->lihat_rt('ikut_askes', 'miskin_master_yatidak', 'Semua Status Ikut ASKES', 'Ikut ASKES', 'kemiskinan/lihat_askes');
    }

    function lihat_jamsostek() {
        $this->lihat_rt('ikut_jamsostek', 'miskin_master_yatidak', 'Semua Status Ikut JAMSOSTEK', 'Ikut JAMSOSTEK', 'kemiskinan/lihat_jamsostek');
    }

    function lihat_kb() {
        $this->lihat_rt('ikut_kb', 'miskin_master_yatidak', 'Semua Status Ikut KB', 'Ikut KB', 'kemiskinan/lihat_kb');
    }

    function lihat_beasiswa_miskin() {
        $this->lihat_rt('ikut_beasiswa_miskin', 'miskin_master_yatidak', 'Semua Status Ikut Beasiswa Miskin', 'Ikut Beasiswa Miskin', 'kemiskinan/lihat_beasiswa_miskin');
    }

    function lihat_blsm() {
        $this->lihat_rt('ikut_blsm', 'miskin_master_yatidak', 'Semua Status Ikut BLSM', 'Ikut BLSM', 'kemiskinan/lihat_blsm');
    }

    function lihat_spm() {
        $this->lihat_rt('ikut_spm', 'miskin_master_yatidak', 'Semua Status Ikut SPM', 'Ikut SPM', 'kemiskinan/lihat_spm');
    }

    function lihat_jampersal() {
        $this->lihat_rt('ikut_jampersal', 'miskin_master_yatidak', 'Semua Status Ikut JAMPERSAL', 'Ikut JAMPERSAL', 'kemiskinan/lihat_jampersal');
    }

    function lihat_bedah_rumah() {
        $this->lihat_rt('ikut_bedahrumah', 'miskin_master_yatidak', 'Semua Status Ikut Bedah Rumah', 'Ikut Bedah Rumah', 'kemiskinan/lihat_bedah_rumah');
    }

    function lihat_program_lain() {
        $this->lihat_rt('ikut_program_lain2', 'miskin_master_yatidak', 'Semua Status Ikut Program Lain', 'Ikut Program Lain', 'kemiskinan/lihat_program_lain');
    }

    function detail_keluarga() {
        $session = $this->session->userdata('login');
        if ($session == NULL) {
            redirect(site_url() . '/login');
            exit();
        }
        $this->load->view('theme/header');
        $this->load->view('theme/sidebar_miskin');
        $id_keluarga = $this->input->get('id_keluarga');
        $id_kec = $this->input->get('id_kecamatan');
        $this->load->model('kemiskinan_model');
        $detil_keluarga = $this->kemiskinan_model->get_anggota_keluarga($id_keluarga, $id_kec);
        $this->load->view('kemiskinan/v_detil', array(
            'anggota_keluarga' => $detil_keluarga,
            'kedudukan_keluarga' => $this->kemiskinan_model->get_list_master('miskin_master_hubungan_kk'),
            'status_perkawinan' => $this->kemiskinan_model->get_list_master('miskin_master_pernikahan'),
            'kartu_id' => $this->kemiskinan_model->get_list_master('miskin_master_kartu_id'),
            'jenis_cacat' => $this->kemiskinan_model->get_list_master('miskin_master_jenis_cacat'),
            'penyakit' => $this->kemiskinan_model->get_list_master('miskin_master_penyakit_kronis'),
            'partisipasi_sekolah' => $this->kemiskinan_model->get_list_master('miskin_master_partisipasi_sekolah'),
            'ijazah' => $this->kemiskinan_model->get_list_master('miskin_master_ijazah'),
            'pekerjaan' => $this->kemiskinan_model->get_list_master('miskin_master_pekerjaan'),
            'keterangan' => $this->kemiskinan_model->get_list_master('miskin_master_keterangan'),
            'aksara' => $this->kemiskinan_model->get_list_master('miskin_master_yatidak', 'ket2'),
            'detil_keluarga' => $this->kemiskinan_model->get_detil_keluarga($id_keluarga, $id_kec),
            'rumah' => $this->kemiskinan_model->get_list_master('miskin_master_status_kepemilikan_rumah'),
            'lantai' => $this->kemiskinan_model->get_list_master('miskin_master_jenis_lantai'),
            'dinding' => $this->kemiskinan_model->get_list_master('miskin_master_jenis_dinding'),
            'atap' => $this->kemiskinan_model->get_list_master('miskin_master_jenis_atap'),
            'sumber_minum' => $this->kemiskinan_model->get_list_master('miskin_master_sumber_minum'),
            'cara_dapat_minum' => $this->kemiskinan_model->get_list_master('miskin_master_cara_dapat_minum'),
            'penerangan' => $this->kemiskinan_model->get_list_master('miskin_master_sumber_penerangan'),
            'energi_masak' => $this->kemiskinan_model->get_list_master('miskin_master_energi_memasak'),
            'fasilitas_bab' => $this->kemiskinan_model->get_list_master('miskin_master_penggunaan_fasilitas_bab'),
            'pembuangan_bab' => $this->kemiskinan_model->get_list_master('miskin_master_tempat_pembuangan_tinja'),
            'yatidak2' => $this->kemiskinan_model->get_list_master('miskin_master_yatidak', 'ket2'),
            'yatidak' => $this->kemiskinan_model->get_list_master('miskin_master_yatidak'),
                )
        );
        $this->load->view('theme/footer');
    }

    function detil_individu() {
        $session = $this->session->userdata('login');
        if ($session == NULL) {
            redirect(site_url() . '/login');
            exit();
        }
        $this->load->view('theme/header');
        $this->load->view('theme/sidebar_miskin');
        $this->load->model('kemiskinan_model');
        $id_warga = (int) $this->input->get('id');
        $nik = $this->input->get('nik');
        $filter = '';
        if ($id_warga > 0) {
            $filter = 'id_warga=' . $id_warga;
        } else {
            if (is_numeric($nik)) {
                $filter = "no_kependudukan like '%$nik%'";
            } else {
                $filter = 'id_warga=0';
            }
        }
        $detil_warga = $this->kemiskinan_model->get_detil_warga($filter);
        $this->load->view('kemiskinan/v_detil2', array(
            'detil_warga' => $detil_warga,
            'kedudukan_keluarga' => $this->kemiskinan_model->get_list_master('miskin_master_hubungan_kk'),
            'jenis_kelamin' => $this->kemiskinan_model->get_list_master('miskin_master_jenis_kelamin'),
            'pernikahan' => $this->kemiskinan_model->get_list_master('miskin_master_pernikahan'),
            'kartu_id' => $this->kemiskinan_model->get_list_master('miskin_master_kartu_id'),
            'jenis_cacat' => $this->kemiskinan_model->get_list_master('miskin_master_jenis_cacat'),
            'penyakit' => $this->kemiskinan_model->get_list_master('miskin_master_penyakit_kronis'),
            'partisipasi_sekolah' => $this->kemiskinan_model->get_list_master('miskin_master_partisipasi_sekolah'),
            'ijazah' => $this->kemiskinan_model->get_list_master('miskin_master_ijazah'),
            'pekerjaan' => $this->kemiskinan_model->get_list_master('miskin_master_pekerjaan'),
            'yatidak' => $this->kemiskinan_model->get_list_master('miskin_master_yatidak'),
            'keterangan' => $this->kemiskinan_model->get_list_master('miskin_master_keterangan'),
                )
        );
        $this->load->view('theme/footer');
    }

}
